<template>
  <div class="wrapper" style="position: absolute; z-index: 200;top: 14px;width: auto">
    <div class="selectModelType" >
      <div class="tip"><p>水流 | 面板</p></div>
      <div></div>
    </div>
  </div>
</template>

<script>

    import PolylineTrailLinkMaterialProperty from "../../script/utils/PolylineTrailMaterialProperty.js";
    import {getRiver} from "../../data/river/riverData.js"
    export default {
      name: "waterFlow",
      mounted() {
        this.create();
      },
      components:{
      },
      methods:{
        create() {
          getRiver().forEach((item,index)=>{
            this.SetLine(item);
          });
          viewer.flyTo(viewer.entities);
        },
        SetLine(riverName){
          let material = new PolylineTrailLinkMaterialProperty({
            color: Cesium.Color.GREEN,
            duration: 3000,
            trailImage: "../image/colors.png"
          });

          let DegreesArray = [];
          let riverLine_Array = riverName.features[0].geometry.coordinates;   //这是数组

          riverLine_Array.forEach((item)=>{
            DegreesArray.push(item[0]);
            DegreesArray.push(item[1]);
            DegreesArray.push(0);
          });

          viewer.entities.add({
            position:Cesium.Cartesian3.fromDegreesArrayHeights(DegreesArray),
            polyline:{
              positions: Cesium.Cartesian3.fromDegreesArrayHeights(DegreesArray),
              width:5,
              clampToGround : true,//贴地
              material:material,  //162,242,242
            }
          });
        },

      },
      destroyed() {
        mapBaseF.removeAllNtt()
      }

    }
</script>

<style scoped>

</style>
